/*
 * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
 * This devtool is neither made for production nor for readable output files.
 * It uses "eval()" calls to create a separate source file in the browser devtools.
 * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
 * or disable the default devtool with "devtool: false".
 * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/).
 */
/******/ (() => { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ "./src/index.js":
/*!**********************!*\
  !*** ./src/index.js ***!
  \**********************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _page_event__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./page/event */ \"./src/page/event.js\");\n// import {\r\n//     appendNumber\r\n// } from \"./page/appendNumber\"\r\n\r\n// import './page/appendNumber'\r\n\r\n\r\n\r\n\r\n\r\n\r\n// import {\r\n//     isPrime\r\n// } from \"./util/isPrime\";\r\n\r\n// import {\r\n//     randColor\r\n// } from './util/randomColor';\r\n\r\n// import {\r\n//     NumberTimer\r\n// } from \"./util/number\";\r\n\r\n\r\n// var n = new NumberTimer()\r\n// n.start()\r\n\r\n\r\n// console.log(isPrime(1))\r\n// console.log(isPrime(2))\r\n// console.log(isPrime(3))\r\n// console.log(isPrime(4))\r\n// console.log(isPrime(5))\r\n\r\n\r\n// console.log(randColor())\r\n// console.log(randColor())\r\n// console.log(randColor())\r\n// console.log(randColor())\r\n// console.log(randColor())\r\n// console.log(randColor())\r\n// console.log(randColor())\r\n// console.log(randColor())\r\n// console.log(randColor())\n\n//# sourceURL=webpack://chapter1/./src/index.js?");

/***/ }),

/***/ "./src/page/appendNumber.js":
/*!**********************************!*\
  !*** ./src/page/appendNumber.js ***!
  \**********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"appendContainer\": () => (/* binding */ appendContainer)\n/* harmony export */ });\n/* harmony import */ var _util_randomColor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/randomColor */ \"./src/util/randomColor.js\");\n\r\n\r\n\r\nconst divContainer = document.querySelector('#divContainer')\r\nconst divCenter = document.querySelector('#divCenter')\r\n\r\n\r\nfunction appendContainer(n, isPrime) {\r\n    const span = document.createElement('span')\r\n    span.innerText = n\r\n    if (isPrime) {\r\n        var color = (0,_util_randomColor__WEBPACK_IMPORTED_MODULE_0__.randColor)()\r\n        span.style.color = color;\r\n        createCenterPrimeNumber(n, color)\r\n    }\r\n    divContainer.appendChild(span)\r\n    //产生中间的数字\r\n    createCenter(n)\r\n}\r\n\r\nfunction createCenter(n) {\r\n    divCenter.innerText = n;\r\n}\r\n\r\nfunction createCenterPrimeNumber(n, color) {\r\n    const div = document.createElement('div')\r\n    div.className = 'center'\r\n    div.innerHTML = n\r\n    var color = (0,_util_randomColor__WEBPACK_IMPORTED_MODULE_0__.randColor)()\r\n    div.style.color = color;\r\n    document.body.appendChild(div)\r\n    getComputedStyle(div).left; //重新渲染页面\r\n\r\n    div.style.transform = `translate(${(0,_util_randomColor__WEBPACK_IMPORTED_MODULE_0__.random)(200,-200)}px,${(0,_util_randomColor__WEBPACK_IMPORTED_MODULE_0__.random)(200,-200)}px)`\r\n    div.style.opacity = 0;\r\n}\n\n//# sourceURL=webpack://chapter1/./src/page/appendNumber.js?");

/***/ }),

/***/ "./src/page/event.js":
/*!***************************!*\
  !*** ./src/page/event.js ***!
  \***************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _appendNumber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./appendNumber */ \"./src/page/appendNumber.js\");\n/* harmony import */ var _util_number__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/number */ \"./src/util/number.js\");\n\r\n\r\n\r\n\r\nconst n = new _util_number__WEBPACK_IMPORTED_MODULE_1__.NumberTimer();\r\nn.callback = function (n, isPrime) {\r\n    (0,_appendNumber__WEBPACK_IMPORTED_MODULE_0__.appendContainer)(n, isPrime)\r\n}\r\nn.start()\n\n//# sourceURL=webpack://chapter1/./src/page/event.js?");

/***/ }),

/***/ "./src/util/isPrime.js":
/*!*****************************!*\
  !*** ./src/util/isPrime.js ***!
  \*****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"isPrime\": () => (/* binding */ isPrime)\n/* harmony export */ });\n/**\r\n * 判断数字是否是素数\r\n */\r\n\r\nfunction isPrime(n) {\r\n    if (n < 2) {\r\n        return false\r\n    }\r\n\r\n    for (var i = 2; i < n - 1; i++) {\r\n        if (n % i === 0) {\r\n            // 2到n-1之间有一个数能整除n\r\n            return false\r\n        }\r\n    }\r\n    return true\r\n}\n\n//# sourceURL=webpack://chapter1/./src/util/isPrime.js?");

/***/ }),

/***/ "./src/util/number.js":
/*!****************************!*\
  !*** ./src/util/number.js ***!
  \****************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"NumberTimer\": () => (/* binding */ NumberTimer)\n/* harmony export */ });\n/* harmony import */ var _isPrime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isPrime */ \"./src/util/isPrime.js\");\n/**\r\n * 用来创建数字，不断增加\r\n */\r\n\r\nclass NumberTimer {\r\n\r\n    constructor(duration = 500) {\r\n        this.duration = duration; //每隔多少时间增加一个数字\r\n        this.number = 1; //数字从1开始\r\n        this.timerId = null; //计时器开关\r\n        this.callback = null; //数字产生后的回调函数\r\n    }\r\n\r\n    // 运行这个函数\r\n    start() {\r\n        if (this.timerId) {\r\n            return;\r\n        }\r\n\r\n        this.timerId = setInterval(() => {\r\n            this.callback && this.callback(this.number, (0,_isPrime__WEBPACK_IMPORTED_MODULE_0__.isPrime)(this.number))\r\n            this.number++\r\n            // console.log(this.number)\r\n        }, this.duration)\r\n    }\r\n\r\n    stop() {\r\n        clearInterval(this.timerId)\r\n        this.timerId = null;\r\n    }\r\n\r\n}\n\n//# sourceURL=webpack://chapter1/./src/util/number.js?");

/***/ }),

/***/ "./src/util/randomColor.js":
/*!*********************************!*\
  !*** ./src/util/randomColor.js ***!
  \*********************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \"random\": () => (/* binding */ random),\n/* harmony export */   \"randColor\": () => (/* binding */ randColor)\n/* harmony export */ });\nvar colors = [\"#f26395\", \"#62efab\", \"#ef7658\", \"#ffe868\", \"#80e3f7\", \"#d781f9\"];\r\n\r\n\r\nfunction random(max, min) {\r\n    return Math.floor(Math.random() * (max - min) + min)\r\n}\r\n\r\nfunction randColor() {\r\n    var index = random(colors.length, 0)\r\n    return colors[index];\r\n}\n\n//# sourceURL=webpack://chapter1/./src/util/randomColor.js?");

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/define property getters */
/******/ 	(() => {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = (exports, definition) => {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	(() => {
/******/ 		__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ 	})();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	(() => {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = (exports) => {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	})();
/******/ 	
/************************************************************************/
/******/ 	
/******/ 	// startup
/******/ 	// Load entry module and return exports
/******/ 	// This entry module can't be inlined because the eval devtool is used.
/******/ 	var __webpack_exports__ = __webpack_require__("./src/index.js");
/******/ 	
/******/ })()
;